//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.tongle.frs.common.util;

import com.tongle.frs.common.log.HiwiLog;
import com.tongle.frs.common.log.HiwiLogFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;

public class SpringUtils {
    private static HiwiLog log = HiwiLogFactory.getLogger(SpringUtils.class);
    private static ApplicationContext ctx;

    public SpringUtils() {
    }

    public static void setCtx(ApplicationContext ctx) {
        ctx = ctx;
    }

    public static <T> T getBean(String name, Class<T> requiredType) {
        try {
            Object ex = ctx.getBean(name, requiredType);
            return (T) ex;
        } catch (BeansException var3) {
            log.error(var3);
            return null;
        }
    }

    public static Object getBean(String name) throws BeansException {
        return ctx.getBean(name);
    }

    public static <T> T getBean(Class<T> requiredType) throws BeansException {
        return ctx.getBean(requiredType);
    }
}
